<!DOCTYPE html>
<html>
    <head>
        <meta name="layout" content="main" />
        <g:set var="entityName" value="${message(code: 'opportunity.label', default: 'Opportunity')}" />
        <title>订单：${this.opportunity.serialNumber}</title>
    </head>
    <body class="fixed-navbar fixed-sidebar">
        <div class="small-header">
            <div class="hpanel">
                <div class="panel-body">
                    <div id="hbreadcrumb" class="pull-right">
                        <ol class="hbreadcrumb breadcrumb">
                            <li>Cake Store</li>
                            <li><g:link controller="opportunity" action="index">订单管理</g:link></li>
                            <li class="active">
                                <span>${this.opportunity.serialNumber}</span>
                            </li>
                        </ol>
                    </div>

                    <h2 class="font-light m-b-xs" style="text-transform:none;">
                        订单: ${this.opportunity.serialNumber}
                    </h2>
                </div>
            </div>
        </div>

        <div class="content animate-panel">
            <div class="hpanel hblue">
                <div class="panel-heading">
                    <div class="panel-tools">
                        <g:if test="${this.opportunity.stage?.name == '未发货' && this.opportunity.status != 'Failed'}">
                            <g:link class="btn btn-info btn-xs" action="changOpportunityStage" resource="${this.opportunity}" params="[stage: '已发货']" id="${this?.opportunity?.id}"><i class="fa fa-edit"></i>已发货</g:link>
                            <g:link class="btn btn-danger btn-xs" action="changOpportunityStatus" resource="${this.opportunity}" params="[status: 'Failed']" id="${this?.opportunity?.id}"><i class="fa fa-edit"></i>已失败</g:link>
                        </g:if>
                        <g:if test="${this.opportunity.stage?.name == '已发货' && this.opportunity.status != 'Failed'}">
                            <g:link class="btn btn-success btn-xs" action="changOpportunityStage" resource="${this.opportunity}" params="[stage: '已完成']" id="${this?.opportunity?.id}"><i class="fa fa-edit"></i>已完成</g:link>
                        </g:if>
                        <a class="showhide"><i class="fa fa-chevron-up"></i></a>
                    </div>
                    订单详情
                </div>

                <div class="panel-body form-horizontal">
                    <div class="form-group">
                        <label class="col-md-2 control-label">订单号</label>

                        <div class="col-md-3">
                            <p class="form-control-static">${this.opportunity?.serialNumber}</p>
                        </div>
                        <label class="col-md-2 control-label">产品名称</label>

                        <div class="col-md-3">
                            <p class="form-control-static">${this.opportunity?.product?.name}</p>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-md-2 control-label">状态</label>

                        <div class="col-md-3">
                            <p class="form-control-static">${this.opportunity?.status}</p>
                        </div>
                        <label class="col-md-2 control-label">阶段</label>

                        <div class="col-md-3">
                            <p class="form-control-static">${this.opportunity?.stage?.name}</p>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-md-2 control-label">单价</label>

                        <div class="col-md-3">
                            <p class="form-control-static">${this.opportunity?.unitPrice} 元</p>
                        </div>
                        <label class="col-md-2 control-label">数量</label>

                        <div class="col-md-3">
                            <p class="form-control-static">${this.opportunity?.quantity} 个</p>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-md-2 control-label">总价</label>

                        <div class="col-md-3">
                            <p class="form-control-static">${this.opportunity?.totalPrice} 元</p>
                        </div>
                        <label class="col-md-2 control-label">尺寸</label>

                        <div class="col-md-3">
                            <p class="form-control-static">${this.opportunity?.size} 寸</p>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-md-2 control-label">下单时间</label>

                        <div class="col-md-3">
                            <p class="form-control-static"><g:formatDate date="${this.opportunity?.createdDate}" format="yyyy-MM-dd HH:mm:ss"></g:formatDate></p>
                        </div>
                        <label class="col-md-2 control-label">送达时间</label>

                        <div class="col-md-3">
                            <p class="form-control-static"><g:formatDate date="${this.opportunity?.arrivalDate}" format="yyyy-MM-dd"></g:formatDate></p>
                        </div>
                    </div>

                    <div class="form-group">
                        
                        <g:if test="${this.opportunity.status == 'Failed'}">
                            <label class="col-md-2 control-label">失效时间</label>
                        </g:if>
                        <g:if test="${this.opportunity.status != 'Failed' && this.opportunity.stage?.name == '未发货'}">
                            <label class="col-md-2 control-label">商品添加时间</label>
                        </g:if>
                        <g:if test="${this.opportunity.status != 'Failed' && this.opportunity.stage?.name == '已发货'}">
                            <label class="col-md-2 control-label">发货时间</label>
                        </g:if>
                        <g:if test="${this.opportunity.status != 'Failed' && this.opportunity.stage?.name == '已完成'}">
                            <label class="col-md-2 control-label">完成时间</label>
                        </g:if>
                        <div class="col-md-3">
                            <p class="form-control-static"><g:formatDate date="${this.opportunity?.modifiedDate}" format="yyyy-MM-dd HH:mm:ss"></g:formatDate></p>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-md-2 control-label">客户留言</label>

                        <div class="col-md-3">
                            <p class="form-control-static">${this.opportunity?.message}</p>
                        </div>
                    </div>
                </div>
            </div>

            <div class="hpanel hyellow">
                <div class="panel-heading">
                    <div class="panel-tools">
                        <a class="showhide"><i class="fa fa-chevron-up"></i></a>
                    </div>
                    客户信息
                </div>

                <div class="panel-body form-horizontal">
                    <div class="form-group">
                        <label class="col-md-2 control-label">姓名</label>

                        <div class="col-md-3">
                            <p class="form-control-static">${this.opportunity?.contact?.fullName}</p>
                        </div>
                        <label class="col-md-2 control-label">电话</label>

                        <div class="col-md-3">
                            <p class="form-control-static">${this.opportunity?.contact?.cellphone}</p>
                        </div>
                    </div>
                </div>
            </div>

            <div class="hpanel hred">
                <div class="panel-heading">
                    <div class="panel-tools">
                        <a class="showhide"><i class="fa fa-chevron-up"></i></a>
                    </div>
                    收货地址信息
                </div>

                <div class="panel-body form-horizontal">

                    <div class="form-group">
                        <label class="col-md-2 control-label">姓名</label>
                        <div class="col-md-3">
                            <p class="form-control-static">${this.opportunity?.address?.fullName}</p>
                        </div>

                        <label class="col-md-2 control-label">电话</label>
                        <div class="col-md-3">
                            <p class="form-control-static">${this.opportunity?.address?.cellphone}</p>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-md-2 control-label">城市</label>
                        <div class="col-md-3">
                            <p class="form-control-static">${this.opportunity?.address?.city}</p>
                        </div>

                        <label class="col-md-2 control-label">地址</label>
                        <div class="col-md-3">
                            <p class="form-control-static">${this.opportunity?.address?.address}</p>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-md-2 control-label">邮编</label>
                        <div class="col-md-3">
                            <p class="form-control-static">${this.opportunity?.address?.zip}</p>
                        </div>

                        <label class="col-md-2 control-label">邮箱</label>
                        <div class="col-md-3">
                            <p class="form-control-static">${this.opportunity?.address?.email}</p>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </body>
</html>
